<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>盒子模型 | css的学习</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../css/textyichu.html" />
    
    
    <link rel="prev" href="../css/textalign.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="3.6"
        data-chapter-title="盒子模型"
        data-filepath="css/盒子模型.md"
        data-basepath=".."
        data-revision="Mon Jul 23 2018 09:39:03 GMT+0800 (中国标准时间)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        Introduction
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="gitbookInstall.html">
            
                
                    <a href="../gitbookInstall.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        gitbook的安装
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2" data-path="HTML/html.html">
            
                
                    <a href="../HTML/html.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        HTML的学习
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="HTML/HTML文件格式.html">
            
                
                    <a href="../HTML/HTML文件格式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        HTML的文件声明
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" >
            
            <span><b>2.2.</b> html标签</span>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.2.1" >
            
            <span><b>2.2.1.</b> a标签</span>
            
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="css/CSS的学习.html">
            
                
                    <a href="../css/CSS的学习.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        CSS的学习
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="css/yinyong.html">
            
                
                    <a href="../css/yinyong.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        css引用方式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="css/select.html">
            
                
                    <a href="../css/select.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        css选择符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="css/font.html">
            
                
                    <a href="../css/font.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        css设置字体样式font
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="css/background.html">
            
                
                    <a href="../css/background.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.4.</b>
                        
                        通过CSS设置背景background
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="css/textalign.html">
            
                
                    <a href="../css/textalign.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.5.</b>
                        
                        文字对齐方式和光标样式
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="3.6" data-path="css/盒子模型.html">
            
                
                    <a href="../css/盒子模型.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.6.</b>
                        
                        盒子模型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.7" data-path="css/textyichu.html">
            
                
                    <a href="../css/textyichu.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.7.</b>
                        
                        文字溢出处理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.8" data-path="css/position.html">
            
                
                    <a href="../css/position.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.8.</b>
                        
                        定位position
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="js/00.html">
            
                
                    <a href="../js/00.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        js的学习
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="js/JavaScript简介.html">
            
                
                    <a href="../js/JavaScript简介.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        JavaScript简介
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="js/JavaScript数据类型.html">
            
                
                    <a href="../js/JavaScript数据类型.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                        JavaScript数据类型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="js/JavaScript运算符.html">
            
                
                    <a href="../js/JavaScript运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.</b>
                        
                        javascript运算符
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../" >css的学习</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h3 id="css&#x76D2;&#x5B50;&#x6A21;&#x578B;">css&#x76D2;&#x5B50;&#x6A21;&#x578B;</h3>
<p><strong>&#x76D2;&#x5B50;&#x6A21;&#x578B;=content&#xFF08;&#x5185;&#x5BB9;&#xFF09;+padding&#xFF08;&#x5185;&#x8FB9;&#x8DDD;&#xFF09;+border&#xFF08;&#x8FB9;&#x6846;&#xFF09;+margin&#xFF08;&#x5916;&#x8FB9;&#x8DDD;&#xFF09;</strong></p>
<pre><code>    ** &#x5BB9;&#x5668;&#x7684;&#x5BBD;&#x5EA6; **=content+padding+border
</code></pre><h4 id="&#x8BBE;&#x7F6E;border&#xFF08;&#x8FB9;&#x6846;&#xFF09;">&#x8BBE;&#x7F6E;border&#xFF08;&#x8FB9;&#x6846;&#xFF09;</h4>
<p>border&#xFF1A;X Y Z ; X&#x8868;&#x793A;border&#x7684;&#x5BBD;&#x5EA6;&#xFF0C;Y&#x8868;&#x793A;border&#x7684;&#x6837;&#x5F0F;&#xFF0C;&#xFF3A;&#x8868;&#x793A;&#x53D8;&#x5BBD;&#x641E;&#x5F97;&#x989C;</p>
<pre><code> &#x4E5F;&#x53EF;&#x4EE5;&#x5206;&#x5F00;&#x6765;&#x8868;&#x793A;&#x5373; :border-width   &#x6765;&#x8868;&#x793A;border&#x7684;&#x5BBD;&#x5EA6;
                    border-style   &#x6765;&#x8868;&#x793A;border&#x7684;&#x6837;&#x5F0F;&#xFF0C;
                    &#x5176;&#x4E2D;&#x6837;&#x5F0F;&#x4E3B;&#x8981;&#x6709;&#x56DB;&#x4E2D;&#x5373;solid&#xFF08;&#x5B9E;&#x7EBF;&#xFF09;&#x3001;dotted&#xFF08;&#x70B9;&#x7EBF;&#xFF09;&#x3001;dashed&#xFF08;&#x865A;&#x7EBF;&#xFF09;&#x3001;double&#xFF08;&#x53CC;&#x5B9E;&#x7EBF;&#xFF09;
                    border-color  &#x8FB9;&#x6846;&#x7684;&#x989C;&#x8272;
 border&#x7684;&#x5C5E;&#x6027;&#x6709;&#x56DB;&#x4E2A;&#x5206;&#x522B;&#x662F;&#x4E0A;&#x3001;&#x53F3;&#x3001;&#x4E0B;&#x3001;&#x5DE6;
                 border-top
                 border-right
                 border-bottom
                 border-left                        
</code></pre><h4 id="margin">margin</h4>
<p>&#x5143;&#x7D20;&#x5916;&#x8FB9;&#x8DDD;&#xFF0C;&#x7528;&#x6765;&#x8BBE;&#x7F6E;&#x5143;&#x7D20;&#x4E0E;&#x5143;&#x7D20;&#x4E4B;&#x95F4;&#x7684;&#x95F4;&#x8DDD;&#xFF08;&#x6709;&#x4E0A;&#x4E0B;&#x5DE6;&#x53F3;&#x7684;&#x5206;&#x652F;&#xFF09;,</p>
<pre><code>                &#x5F53;&#x53EA;&#x8BBE;&#x7F6E;&#x4E00;&#x4E2A;&#x503C;&#x7684;&#x65F6;&#x5019;&#x8FD9;&#x4E2A;&#x503C;&#x4EE3;&#x8868;&#x4E86;&#x56DB;&#x4E2A;&#x65B9;&#x5411;&#x7684;&#x5916;&#x8FB9;&#x8DDD;&#x503C;,
                &#x5F53;&#x6709;2&#x4E2A;&#x503C;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x7B2C;&#x4E00;&#x4E2A;&#x503C;&#x4EE3;&#x8868;&#x6C34;&#x5E73;&#x65B9;&#x5411;&#x7684;&#x503C;&#xFF0C;&#x7B2C;&#x4E8C;&#x4E2A;&#x4EE3;&#x8868;&#x5782;&#x76F4;&#x65B9;&#x5411;&#x7684;margin&#x503C;
                &#x5F53;&#x8BBE;&#x7F6E;3&#x4E2A;&#x503C;&#x7684;&#x65F6;&#x5019;&#xFF0C; &#x7B2C;&#x4E00;&#x4E2A;&#x503C;&#x4EE3;&#x8868;&#x9876;&#x90E8;&#x7684;&#x503C;&#xFF0C;&#x7B2C;&#x4E8C;&#x4E2A;&#x4EE3;&#x8868;&#x5782;&#x76F4;&#x65B9;&#x5411;&#x7684;margin&#x503C;&#xFF0C;&#x7B2C;&#x4E09;&#x4E2A;&#x8868;&#x793A;&#x5E95;&#x90E8;&#x7684;&#x503C;
                &#x6709;&#x56DB;&#x4E2A;&#x503C;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x5206;&#x522B;&#x8868;&#x793A;&#x4ECE;&#x9876;&#x90E8;&#x5F00;&#x59CB;&#xFF0C;&#x987A;&#x65F6;&#x9488;&#x8F6C;&#x52A8;&#x7684;&#x56DB;&#x6761;&#x8FB9;&#x7684;&#x503C;          
</code></pre><p>padding &#x8BBE;&#x7F6E;&#x5185;&#x5BB9;&#x4E0E;&#x8FB9;&#x6846;&#x4E4B;&#x95F4;&#x7684;&#x8DDD;&#x79BB;&#xFF0C;&#x5185;&#x8FB9;&#x8DDD;,&#x5177;&#x4F53;&#x7684;&#x8BBE;&#x7F6E;&#x65B9;&#x6CD5;&#x4E0E;margin&#x76F8;&#x540C;    </p>
<h4 id="&#x5143;&#x7D20;&#x7C7B;&#x578B;">&#x5143;&#x7D20;&#x7C7B;&#x578B;</h4>
<pre><code>            &#x5757;&#x7EA7;&#x5143;&#x7D20;&#xFF08; &#x5728;css&#x4E2D;&#x7528;display&#xFF1A;block&#xFF09;


                1&#x3001;&#x72EC;&#x5360;&#x5176;&#x7236;&#x7EA7;&#x5143;&#x7D20;&#x7684;&#x4E00;&#x6574;&#x884C;
                2&#x3001;&#x53EF;&#x8BBE;&#x7F6E;&#x5BBD;&#x9AD8;

            &#x884C;&#x5185;&#x5143;&#x7D20;&#xFF08; &#x5728;css&#x4E2D;&#x7528;display&#xFF1A;inline&#xFF09;
                1&#x3001;&#x5185;&#x5BB9;&#x591A;&#x5C11;&#x5C31;&#x5360;&#x591A;&#x5927;&#x4F4D;&#x7F6E;&#xFF0C;&#x884C;&#x5185;&#x5143;&#x7D20;&#x53EF;&#x4EE5;&#x5E76;&#x6392;&#x6392;&#x5217;
                2&#x3001;&#x4E0D;&#x80FD;&#x8BBE;&#x7F6E;&#x5BBD;&#x9AD8;
                3&#x3001;&#x4E0D;&#x80FD;&#x8BBE;&#x7F6E;&#x9876;&#x90E8;&#x548C;&#x9876;&#x90E8;&#x5916;&#x8FB9;&#x8DDD;margin
                4&#x3001;&#x884C;&#x5185;&#x5143;&#x7D20;&#x4E0A;&#x4E0B;&#x7684;padding&#x503C;&#xFF08;&#x5373;&#x5185;&#x8FB9;&#x8DDD;&#xFF09;&#x4E0D;&#x5360;&#x4F4D;&#x7F6E;&#x7A7A;&#x95F4;
          &#x884C;&#x5185;&#x5757;&#x7EA7;&#x5143;&#x7D20;&#xFF08;&#x5728;css&#x4E2D;&#x7528;displa&#xFF1A;inline- block&#xFF09; 
                1&#x3001;&#x65E2;&#x6709;&#x5757;&#x7EA7;&#x5143;&#x7D20;&#x7684;&#x7279;&#x6027;&#xFF0C;&#x4E5F;&#x6709;&#x884C;&#x5185;&#x5143;&#x7D20;&#x7684;&#x7279;&#x6027;&#xFF0C;&#x6BD4;&#x5982;&#x65E2;&#x53EF;&#x4EE5;&#x8BBE;&#x7F6E;&#x5BBD;&#x9AD8;&#xFF0C;
                            &#x4E5F;&#x53EF;&#x5728;&#x540C;&#x4E00;&#x884C;&#x6392;&#x5217;
            &#x5B66;&#x8FC7;&#x7684;&#x884C;&#x5185;&#x5757;&#x7EA7;&#x5143;&#x7D20;    img   input                
</code></pre>
                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../css/textalign.html" class="navigation navigation-prev " aria-label="Previous page: 文字对齐方式和光标样式"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../css/textyichu.html" class="navigation navigation-next " aria-label="Next page: 文字溢出处理"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../gitbook/app.js"></script>

    
    <script src="../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-livereload/plugin.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"livereload":{}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
